<template>
  <div v-loading="loading" class="app-container">
    <h3 class="tac">{{ info.title }}</h3>
    <div v-html="info.content" />
    <div class="tac">
      <span>
        <el-button @click="back">返回</el-button>
      </span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'NoticeInfo',
  data() {
    return {
      loading: false,
      info: {}
    }
  },
  created() {
    const vm = this
    const { id } = vm.$route.params
    vm.getInfo(id)
  },
  methods: {
    getInfo(id) {
      const vm = this
      vm.loading = true
      vm.$http
        .get(`/notice/${id}`)
        .then((res) => {
          vm.info = res.data
          vm.loading = false
        })
        .catch(() => {
          vm.loading = false
        })
    },
    back() {
      this.$router.go(-1)
    }
  }
}
</script>

<style lang="scss" scoped></style>
